//
//  HRTabBarViewController.m
//  Economical report
//
//  Created by wyzc on 16/6/23.
//  Copyright © 2016年 叶落知秋. All rights reserved.
//

#import "HRTabBarViewController.h"
#import "HRNavViewController.h"
#import "HRHomeXBSController.h"
#import "HRNumberViewController.h"
#import "HRBulletinViewController.h"
#import "HRInvestmentViewController.h"
#import "HRMyViewController.h"

@interface HRTabBarViewController ()

@end

@implementation HRTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //添加首页控制器
    HRHomeXBSController *homeVc=[[HRHomeXBSController alloc] init];
    [self addController:homeVc Title:@"首页" NormalImage:@"nav_home" SelectedImage:@"nav_home_hover"];
    //添加数字报控制器
    HRNumberViewController *numberVc=[[HRNumberViewController alloc] init];
    [self addController:numberVc Title:@"数字报" NormalImage:@"nav_epaper" SelectedImage:@"nav_epaper_hover"];
    //添加捷报控制器
    HRBulletinViewController *bulletinVc=[[HRBulletinViewController alloc] init];
    [self addController:bulletinVc Title:@"捷报" NormalImage:@"nav_herald" SelectedImage:@"nav_herald_hover"];
    //添加资讯通控制器
    HRInvestmentViewController *investmentVc=[[HRInvestmentViewController alloc] init];
    [self addController:investmentVc Title:@"资讯通" NormalImage:@"nav_stock" SelectedImage:@"nav_stock_hover"];
    //添加我的控制器
    HRMyViewController *MyVc=[[HRMyViewController alloc] init];
    [self addController:MyVc Title:@"我" NormalImage:@"nav_user" SelectedImage:@"nav_user_hover"];
}
-(void)addController:(UIViewController *)controller Title:(NSString *)title NormalImage:(NSString *)nomalImage SelectedImage:(NSString *)selectImage
{
    HRNavViewController *naVc=[[HRNavViewController alloc] initWithRootViewController:controller];
    [self addChildViewController:naVc];
    naVc.tabBarItem.title=title;
    UIImage *normalImage=[UIImage imageNamed:nomalImage];
    UIImage *selectedImage=[UIImage imageNamed:selectImage];
    naVc.tabBarItem.image=normalImage;
    naVc.tabBarItem.selectedImage=selectedImage;
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
